<script setup>
import { useRouter } from 'vue-router'
import { ref } from 'vue';

let username = ref('')
let password = ref('')
const router = useRouter()

let fun1 = () => {
    if(username.value == '尹鹏飞' & password.value == '123'){
        router.push({path: '/home', query: {username: username.value, password: password.value}})
        window.localStorage.setItem('username', username.value)
    } else {
        alert('账号或密码错误！')
    }
}

</script>

<template>
  <div>
    姓名：<input type="text" v-model="username"><br>
    密码：<input type="password" v-model="password"><br>
    <input type="button" @click="fun1()" value="提交到home页">
  </div>
</template>

<style scoped>
</style>